<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
</head>

<body>
	<?php
function checkNum($number) {
    if($number > 1) {
        throw new Exception("数字必须小于1");
    }else {
        return true;
    }
}
try {
    checkNum(2);
    echo "小于1";
}catch(Exception $e) {
   echo "Message:" . $e->getMessage();
}
?>
</body>

</html>